package com.smh.a05TCPDemo1;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {

        ServerSocket ss = new ServerSocket(10001);
        //等待客户端链接,死等
        Socket accept = ss.accept();

        //
        InputStream is = accept.getInputStream();

        StringBuilder sb = new StringBuilder();
        int b;
        while ((b = is.read()) != -1) {
            sb.append((char) b);
        }
        System.out.println(sb.toString());

        is.close();
        ss.close();

    }
}
